#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "../umlcore/PartialElement.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Activity;
class ActivityEdge;
class ActivityNode;

/// <summary>
/// ActivityGroup
/// ActivityGroup is an abstract class for defining sets of ActivityNodes and
/// ActivityEdges in an Activity.
/// </summary>
class UMLMODEL_EXPORT ActivityGroup : public PartialElement {

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Methods
    /// <summary>
    /// containingActivity
    /// The Activity that directly or indirectly contains this ActivityGroup.
    /// </summary>
    virtual shared_ptr<Activity> containingActivity() const;

public: // Properties
    /// <summary>
    /// containedEdges getter
    /// ActivityEdges immediately contained in the ActivityGroup.
    /// </summary>
    vector<shared_ptr<ActivityEdge>>& containedEdges();

    /// <summary>
    /// containedNodes getter
    /// ActivityNodes immediately contained in the ActivityGroup.
    /// </summary>
    vector<shared_ptr<ActivityNode>>& containedNodes();

    /// <summary>
    /// inActivity getter
    /// The Activity containing the ActivityGroup, if it is directly owned by an
    /// Activity.
    /// </summary>
    shared_ptr<Activity> inActivity() const;

    /// <summary>
    /// inActivity setter
    /// The Activity containing the ActivityGroup, if it is directly owned by an
    /// Activity.
    /// </summary>
    void setInActivity(shared_ptr<Activity> value);

    /// <summary>
    /// subgroups getter
    /// Other ActivityGroups immediately contained in this ActivityGroup.
    /// </summary>
    vector<shared_ptr<ActivityGroup>>& subgroups();

    /// <summary>
    /// superGroup getter
    /// The ActivityGroup immediately containing this ActivityGroup, if it is directly
    /// owned by another ActivityGroup.
    /// </summary>
    shared_ptr<ActivityGroup> superGroup() const;

    /// <summary>
    /// superGroup setter
    /// The ActivityGroup immediately containing this ActivityGroup, if it is directly
    /// owned by another ActivityGroup.
    /// </summary>
    void setSuperGroup(shared_ptr<ActivityGroup> value);

private: // Fields
    /// <summary>
    /// containedEdges
    /// ActivityEdges immediately contained in the ActivityGroup.
    /// </summary>
    vector<shared_ptr<ActivityEdge>> containedEdges_;

    /// <summary>
    /// containedNodes
    /// ActivityNodes immediately contained in the ActivityGroup.
    /// </summary>
    vector<shared_ptr<ActivityNode>> containedNodes_;

    /// <summary>
    /// inActivity
    /// The Activity containing the ActivityGroup, if it is directly owned by an
    /// Activity.
    /// </summary>
    shared_ptr<Activity> inActivity_;

    /// <summary>
    /// subgroups
    /// Other ActivityGroups immediately contained in this ActivityGroup.
    /// </summary>
    vector<shared_ptr<ActivityGroup>> subgroups_;

    /// <summary>
    /// superGroup
    /// The ActivityGroup immediately containing this ActivityGroup, if it is directly
    /// owned by another ActivityGroup.
    /// </summary>
    shared_ptr<ActivityGroup> superGroup_;

};

} // namespace uml
